<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="zh-CN">
<head>
		<meta charset="UTF-8">
	<title><?php echo ('[title]' == '['.'title'.']' ? C('WEBSITE_NAME') : '[title]');?></title>
	<meta name="viewport" content="initial-scale=1, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
    <meta content="yes" name="apple-mobile-web-app-capable">
	<meta content="red" name="apple-mobile-web-app-status-bar-style">
	<meta name="format-detection" content="telphone=no">
	<link rel="stylesheet" href="/css/mall.css?modify=20161026">
	<link rel="stylesheet" href="/css/trade.css?modify=20161026">
	<link rel="stylesheet" href="/css/red.css">
	<script type="text/javascript">
	var require = {
		baseUrl: '/js',
		waitSeconds: 0,
		map: {
		  '*': {
			'css': '//cdn.bootcss.com/require-css/0.1.8/css.min.js',
			'text': '//cdn.bootcss.com/require-text/2.0.12/text.min.js'
		  }
		},
		shim: {
			swiper: ['jquery', 'css!//cdn.bootcss.com/Swiper/3.3.1/css/swiper.min.css'],
			lazyload: ['jquery'],
		},
		paths: {
            'jquery': '//cdn.bootcss.com/jquery/1.12.4/jquery.min',
			'template': 'template',
			'validatejs': '//cdn.bootcss.com/jquery-validate/1.15.0/jquery.validate.min',
			'weixinjs': 'https://res.wx.qq.com/open/js/jweixin-1.0.0',
			'lazyload': '//cdn.bootcss.com/jquery.lazyload/1.9.1/jquery.lazyload.min',
			'swiper': '//cdn.bootcss.com/Swiper/3.3.1/js/swiper.min',

			'mall/cart': 'h5.js?modify=20161026',
			'view/order/list': 'h5.js?modify=20161026',
			'view/balance': 'h5.js?modify=20161026',
			'module/cart/num': 'h5.js?modify=20161026',
			'order/address': 'h5.js?modify=20161026',
			'pay': 'h5.js?modify=20161026',
			'view/personal/edit': 'h5.js?modify=20161026',
			'view/personal/scoreDetail': 'h5.js?modify=20161026',
			'view/present/list': 'h5.js?modify=20161026',
			'view/score': 'h5.js?modify=20161026',
			'pay/express': 'h5.js?modify=20161026',
			'jsweixin': 'h5.js?modify=20161026',
			'skumodal': 'h5.js?modify=20161026',
			'customer_service': 'h5.js?modify=20161026',
			'order/refund': 'h5.js?modify=20161026',
			'model_pay_coupon': 'h5.js?modify=20161026',
			'login_modal': 'h5.js?modify=20161026',
			'member/collection': 'h5.js?modify=20161026',
            'pullfresh': 'h5.js?modify=20161026',
            'goods_list': 'h5.js?modify=20161026',
          	'search': 'h5.js?modify=20161026',
		}
	}
	</script>
	<?php if(IS_APP): ?><script type="text/javascript" src="/js/appcan.min.js"></script><?php endif; ?>
	<script data-main="/js/h5.js?modify=20161026" src="//cdn.bootcss.com/require.js/2.3.1/require.min.js"></script>
	<?php if(!APP_DEBUG){ require_once 'cs.php';echo '<img src="'._cnzzTrackPageView(1259294058).'" width="0" height="0" style="display:none;"/>'; } ?>
	
	<style>
	.goods-header .goods-price{padding:5px 10px 2px;text-align:left}
	.current-price{color:#f0342b;display:inline-block;font-size:18px}
	.original-price{display:inline-block;font-size:12px;margin-left:10px;text-decoration:line-through;color:#ddd}
	.other-info{background-color:#fff;padding:0 10px}
	.other-info dl{margin:8px 0;width:50%;float:left}
	.other-info dt{float:left;color:#999}
	.other-info dd{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
	.store-arrow-right:after{content:'';position:absolute;top:15px;right:10px;width:6px;height:11px;background:url("/img/mall/goods@2x_c9431a6d41.png") no-repeat;background-position:-40px -18px;background-size:58px 48px}
	.goods-detail{margin-top:10px}
	.tabber button.active,.tabber a.active{position:relative;top:1px;line-height:39px;}
	.tabber button,.tabber a{float:left;width:33.33%;height:40px;line-height:40px;border:0px none;outline:0px none;background-color:#fff;text-align:center;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}
	.custom-richtext{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;font-size:16px;color:#333;overflow:hidden;text-align:left;word-wrap:break-word;overflow-x:auto}
	.block-list-traderecord{padding-left:0;margin-bottom:30px;background-color:#fff;width:100%;border-top:0px none}
	.block-list-traderecord .list-header{padding:0 10px;height:33px;line-height:33px;background-color:#f2f2f2;border-bottom:2px solid #e5e5e5;border-bottom-width:1px;display:table;width:100%;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}
	.block-list-traderecord .list-header .col-1{text-indent:12px}
	.block-list-traderecord .list-header .col-1,.block-list-traderecord .block-item .col-1{width:34%}
	.block-list-traderecord .list-header span,.block-list-traderecord .block-item span{display:table-cell;font-size:12px}
	.block-list-traderecord .list-header .col-2,.block-list-traderecord .block-item .col-2{width:33%}
	.block-list-traderecord .list-header .col-3,.block-list-traderecord .block-item .col-3{width:33%}
	.block-list-traderecord .list-header,.block-list-traderecord .block-item{display:table;width:100%;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}
	.block-list-traderecord .block-list{border-top-width:0;border-bottom-width:0}
	.custom-richtext img{max-width: 100%;display:block;}
	.custom-store .custom-store-link{display:block}
	.custom-store .custom-store-img{position:absolute;top:11px;left:0;height:18px;width:18px;background:url(/img/mall/goods@2x_c9431a6d41.png) -40px 0 no-repeat;background-size:58px 48px}
	.custom-store .custom-store-name{float:left;padding:0 0 0 25px;height:22px;line-height:22px;font-size:14px;color:#333;max-width:210px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
	.custom-store .custom-store-enter{float:right;height:14px;line-height:14px;margin:4px 0;font-size:12px;color:#999;padding-right:15px}
	.goods-store.block-list .renzheng .rz-item{padding-right:16px;white-space:nowrap}
	.goods-store.block-list .offline-store .offline-store-img{display:inline-block;vertical-align:middle;width:18px;height:18px;background-position:0 -30px;background-image:url("/img/mall/goods@2x_c9431a6d41.png");background-repeat:no-repeat;background-size:58px 48px}
	.goods-store.block-list .renzheng .rz-item::before,.goods-store.block-list .offline-store .offline-store-img{background-image:url("/img/mall/goods@2x_c9431a6d41.png");background-repeat:no-repeat;background-size:58px 48px}
	.goods-store.block-list .renzheng .rz-item::before{content:'';display:inline-block;vertical-align:middle;width:13px;height:13px;background-position:-18px -30px}
	.goods-store.block-list .renzheng .rz-item.false::before{background-position:-33px -30px;}
	.bottom-fix{padding:0}
	.components-container{background-color:#fff}
	</style>
	
</head>
<body class="body-fixed-bottom">
	 <div class="container wap-goods internal-purchase">
		<div class="content ">
			<div class="content-body">
				<!-- 商品轮播图 -->
				<div class="scale_wh scale_100">
					<div class="scale_content">
						<div class="js-banner swiper-container">
							<div class="swiper-wrapper">
								<?php if(is_array($data['images'])): foreach($data['images'] as $key=>$url): ?><div class="swiper-slide"><img src="<?php echo ($url); ?>" /></div><?php endforeach; endif; ?>
					  		</div>
					  		<div class="swiper-tip">温馨提示：长按图片保存到手机</div>
					  		<div class="pagination"></div>
						</div>
					</div>
				</div>
				<div class="goods-header">
					<h2 class="title"><?php echo ($data["title"]); ?></h2>
					<div class="goods-price">
						<div class="current-price">
							<span style="font-size: 12px;"><?php echo ($data['agents'][$user['agent_level']]['price_title']); ?>：¥</span><i class="js-goods-price price"><?php echo ($data['agents'][$user['agent_level']]['price']); ?></i>
						</div>
					</div>
				</div>
				<div class="other-info clearfix">
					<?php if($user['agent_level'] == 0): ?><dl>
						<dt><?php echo end($data['agents'])['price_title'];?>：</dt>
						<dd><?php echo end($data['agents'])['price'];?>元</dd>
					</dl>
					<?php else: ?>
					<dl>
						<dt><?php echo ($data['agents'][0]['price_title']); ?>：</dt>
						<dd><?php echo ($data['agents'][0]['price']); ?>元</dd>
					</dl><?php endif; ?>
					<dl><dt>月销量：</dt><dd><?php echo ($data['sold_num']); ?>件</dd></dl>
					<?php if(!empty($data['send_place'])): ?><dl><dt>发货地：</dt><dd><?php echo ($data["send_place"]); ?></dd></dl><?php endif; ?>
					<dl><dt>单品重：</dt><dd><?php echo ($data['weight']); ?>kg</dd></dl>
					<?php if(is_numeric($data['freight_fee'])): ?><dl><dt>最低运费：</dt><dd><?php echo ($data['freight_fee']); ?>元</dd></dl>
					<?php else: ?>
					<dl><dt>快递费：</dt><dd><?php echo ($data['freight_fee']); ?></dd></dl><?php endif; ?>
					<?php if(($data['hide_stock']) == "0"): ?><dl><dt>库存量：</dt><dd><?php echo ($data["stock"]); ?>件</dd></dl><?php endif; ?>
					<dl><dt>赠积分：</dt><dd>0</dd></dl>
				</div>
				<div class="js-store-info">
					<div class="block block-list goods-store">
						<div class="custom-store block-item ">
							<a class="custom-store-link clearfix" href="/h5/list?shop_id=<?php echo ($data['shop_id']); ?>">
								<div class="custom-store-img"></div>
								<div class="custom-store-name"><?php echo ($data['shop_name']); ?></div>
								<span class="custom-store-enter">进入店铺</span>
								<span class="offline-store-enter pull-right store-arrow-right"></span>
							</a>
						</div>
						<div class="renzheng block-item c-gray-darker" style="text-align:center">
							<span class="js-rz-item-alert rz-item <?php echo ($data['invoice'] ? '' : 'false'); ?>" data-type="team_certificate_person">
								<span class="rz-name font-size-12">发票</span>
							</span>
							<span class="js-rz-item-alert rz-item <?php echo ($data['warranty'] ? '' : 'false'); ?>" data-type="is_secured_transactions">
								<span class="rz-name font-size-12">保修</span>
							</span>
							<span class="js-rz-item-alert rz-item <?php echo ($data['returns'] ? '' : 'false'); ?>" data-type="team_physical">
								<span class="rz-name font-size-12">退换</span>
							</span>
							<span class="js-rz-item-alert rz-item <?php echo ($data['freight_fee'] == '包邮' ? '' : 'false'); ?>" data-type="team_physical">
								<span class="rz-name font-size-12">包邮</span>
							</span>
						</div>
					</div>
				</div>
				
				<!-- 图文、成交记录 -->
				<div class="js-tabber-container goods-detail">
					<div class="js-tabber tabber clearfix">
						<button data-type="goods" class="active" style="width:50%">商品详情</button>
						<button data-type="similar" data-id="<?php echo ($data["id"]); ?>" style="width:50%;color:black;" >同类推荐</button>
					</div>
					<div class="js-tabber-content">
						<div class="js-part js-goods-detail goods-tabber-c" data-type="goods">
							<?php if(!empty($data['remote_area'])): ?><div class="custom-notice text-center">此商品<?php echo ($data['remote_area']); ?>不发货</div><?php endif; ?>
							<div class="block block-list">
								<?php if(($data['parameters']!='') and ($data['sku_json']!='')): if(is_array($data['sku_json'])): foreach($data['sku_json'] as $spec_pid=>$item): ?><div class="block-item">
									<label><?php echo ($item["text"]); ?>:</label>
									<span><?php if(is_array($item['items'])): foreach($item['items'] as $key=>$val): echo ($val["text"]); ?>&nbsp;<?php endforeach; endif; ?></span>
								</div><?php endforeach; endif; ?>
								<?php if(($data['parameters']!='')): if(is_array($data['parameters'])): foreach($data['parameters'] as $key=>$item): ?><div class="block-item">
									<label><?php echo ($item[0]); ?>:</label>
									<span><?php echo ($item[1]); ?></span>
								</div><?php endforeach; endif; endif; endif; ?>
							</div>
							<div class="js-components-container components-container">
								<div id="detail_container" class="custom-richtext"></div>
                                <?php if($data['shop_id'] == 12753): ?><div style="text-align:center">
                                <span style="color: #f90;">长按二维码观看韩国代购直播</span>
                                <img src="/upload/image/20161017/491778204446010346.jpg" style="width:80%">
                                </div>
                                <?php else: ?>
								<div class="empty-list"><div><a class="js-lxkf tag tag-big tag-orange" data-type="2" href="javascript:;">获取小视频</a></div></div><?php endif; ?>
							</div>
						</div>
						<div class="js-part hide" data-type="similar" style="margin-bottom:20px">
							<ul class="js-goods-list sc-goods-list pic clearfix size-2">
								<li><div style="padding:30px 0;text-align:center">正在加载中...</div></li>
							</ul>
						</div>
					</div>
				</div>
				<div class="js-bottom-opts js-footer-auto-ele bottom-fix">
					<div class="sku-layout">
		            	<div class="content-foot clearfix">
		            		<a href="javascript:;" class="js-add-collect collect<?php echo ($other['is_collection'] ? ' checked' : ''); ?>" data-id="<?php echo ($data["id"]); ?>"></a>
							<a href="javascript:;" class="kefu js-lxkf" data-shop="<?php echo ($data["shop_id"]); ?>" data-goods="<?php echo ($data["id"]); ?>"></a>
							<a class="cart" href="/h5/cart"><b class="js-cart-num"><?php echo ($other['cart_num']); ?></b><em id="J-addone">+1</em></a>
							<?php if($disabled): ?><div class="actions clearfix">
                                <button id="btn_buy" type="button" class="btn-buy btn btn-orange-dark disabled"><?php echo ($disabled_msg); ?></button>
                            </div>
							<?php else: ?>
                            <div class="actions actions-2 clearfix">
                                <button id="btn_add_cart" type="button" class="btn-cart btn btn-orange">加入购物车</button>
                                <button id="btn_buy" type="button" class="btn-buy btn btn-orange-dark">立即下单</button>
                            </div><?php endif; ?>
						</div>
		            </div>
				</div>
			</div>
		</div>
		<div class="js-footer footer">
	<div class="copyright">
		<div class="ft-links">
			<a href="/h5/mall" target="_blank">商城主页</a>
			<a href="/h5/list" target="_blank">全部商品</a>
			<a href="/h5/personal" target="_blank">会员中心</a>
			<a href="/h5/cart" target="_blank">购物车</a>
		</div>
		<a class="ft-copyright" target="_blank">
			<span class="company hide">兴业宝提供技术支持</span>
		</a>
	</div>
</div>
	</div>
	<div id="right-icon" class="js-right-icon no-text" style="bottom:100px">
		<div class="js-right-icon-container right-icon-container clearfix" style="width: 50px;">
			<a id="global-back" href="javascript:win.back();" class="icon new s1"></a>
	</div></div>
</body>

<script type="text/javascript">
	// 购买/兑换
	require(['skumodal'], function(ShoppingCart){
		$('#btn_buy').on('click',function(){
			var goods_id = this.getAttribute('data-id');
			new ShoppingCart({
				id: <?php echo ($data["id"]); ?>,
				buttons:{'buyNow': '立即下单'},
			});
			return false;
		});
		
		$('#btn_add_cart').on('click',function(){
			var goods_id = this.getAttribute('data-id');
			new ShoppingCart({
				id: <?php echo ($data["id"]); ?>,
				buttons:{'addCart': '加入购物车'},
			});
			return false;
		});
	});
	
	<?php if(IS_WEIXIN): ?>//分享
	require(['jsweixin'], function(jweixin){
	   jweixin.init(<?php echo ($sign); ?>, function(){
			jweixin.share(<?php echo ($share_data); ?>);
	   });
	});<?php endif; ?>

	requirejs(['jquery'], function(){
        require(['swiper'], function(){
            var mySwiper = new Swiper('.js-banner',{
                autoplay : 5000,
                loop : true,
                autoplayDisableOnInteraction : true,
                pagination : '.js-banner .pagination'
            });

            var $banner = $('.js-banner'),
            $wrapper = $banner.children('.swiper-wrapper');
            $banner.on('click', function() {
                $banner.toggleClass('full-screen');
                if($banner.hasClass('full-screen')){
                    $wrapper.css('line-height', document.documentElement.clientHeight+'px');
                }else{
                    $wrapper.css('line-height', '');
                }
                return false;
            });
        });
        
		// 切换商品详情/成交记录
		var $tabberContainer = $('.js-tabber-container'),
		fixedTop = $tabberContainer.offset().top,
		$tabber = $tabberContainer.children('.js-tabber');
		$('.js-tabber>button').on('click', function(){
			var $this = $(this);
			$this.addClass('active').siblings().removeClass('active');
			$('.js-tabber-container>.js-tabber-content>.js-part[data-type="'+$this.attr('data-type')+'"]').removeClass('hide').siblings().addClass('hide');
		
			document.body.scrollTop = fixedTop;
			
			// 同类商品
			if($this.data('type') == 'similar' && !$this.data('loading')){
				$this.data('loading', 1);
				require(['goods_list'], function(gv){
					gv.start({
						url: '<?php echo ($same_url); ?>',
						container: '.js-goods-list',
					}); 
				});
			}
			return false;
		});
		
		window.addEventListener('scroll', function(){
			if(document.body.scrollTop > fixedTop){
				$tabber.addClass('top-fix');
			}else{
				$tabber.removeClass('top-fix');
			}
		}, false);
		
		// 显示图文详情
		$('#detail_container').load('/h5/goods/detail?id=<?php echo ($data["id"]); ?>');
	});
</script>
</html>